﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace ProjectNocturnalFool
{
    class CharacterEditScreen : MenuScreen
    {
        CharacterEditOptionsPanel characterOptionsPanel;
        CharacterDisplayPanel characterDisplayPanel;

        /// <summary>
        /// Loads the control and sub controls
        /// </summary>
        public override void LoadContent()
        {
            base.LoadContent();
            
            characterOptionsPanel = new CharacterEditOptionsPanel();
            characterOptionsPanel.LoadContent();
            characterOptionsPanel.x = contentPanel.x;
            characterOptionsPanel.y = contentPanel.y;
            characterOptionsPanel.width = contentPanel.width / 2;
            characterOptionsPanel.height = contentPanel.height;
            contentPanel.controls.Add(characterOptionsPanel);


            characterDisplayPanel = new CharacterDisplayPanel();
            characterDisplayPanel.LoadContent();
            characterDisplayPanel.x = contentPanel.x + (contentPanel.width / 2);
            characterDisplayPanel.y = contentPanel.y;
            characterDisplayPanel.width = contentPanel.width / 2;
            characterDisplayPanel.height = contentPanel.height;
            contentPanel.controls.Add(characterDisplayPanel);
        }

        public override void HandleState()
        {
            base.HandleState();

            Tuple<string, int, int> match = updateStatus.Find(p => (p.Item1 == typeof(Button_Type).Name && p.Item2 == (int)Button_Type.EditConfirm));
            if (match != null)
                GameLogic.Instance.gameCharacterSession.charList[GameLogic.Instance.gameCharacterSession.editIndex] = GameLogic.Instance.gameCharacterSession.editCharacter;
        }

    }
}
